-- enter_gain_attrib
-- created by zhuangsl
-- 进入迷宫时获得迷宫属性

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 触发
    trigger = function(who, prop, targetPos)
        local floor = DungeonM.currentLayer();
        if floor ~= 1 then
            return;
        end

        -- 不管洞窟、夹层
        if DungeonInstanceM.isInInstance() or UnrealDungeonM.isInUnreal() then
            return;
        end

        -- 首次进入迷宫时，不在这里处理
        local max_dungeon_layer = ME.user.dbase:query("max_dungeon_layer", 0);
        if max_dungeon_layer > 1 then
            return false;
        end

        -- 累计能量
        local energy = prop[2];
        local value = tonumber(prop[3]);

        DungeonServiceM.addDungeonAttrib(energy, value);
    end,

    record = function(target, prop, path)
        return false;
    end,

    desc = function(prop)

        return desc;
    end
};
